import http from "./http";
import qs from "qs";

const oneParamHeader = {
    'content-type': 'application/x-www-form-urlencoded;charset=utf-8'
}

const jsonHeader = {
    'content-type': 'application/json'
}

const fromHeader = {
    'content-type': 'multipart/form-data'
}

// 用户登录
export const login = (data, config = { jsonHeader }) => http.post('/api/doLogin', data, config)
/** 
获取菜单(kind)：
    0.获取全部菜单（树形结构,包含按钮） 
    1.获取当前登录用户的菜单(树形结构,不包含按钮)
    2.获取指定角色的菜单权限(树形结构,不包含按钮) 
    3.获取指定角色的菜单权限(树形结构,包含按钮)
*/ 
export const getMenus = (data, config = {}) => http.post('/api/menu/getList', qs.stringify(data), config)
// 获取当前页面的按钮权限
export const getBtnList = (data, config = {}) => http.post('/api/system/getBtnList', qs.stringify(data), config)
// 获取首页
export const index = (data, config = {}) => http.post('/api/index', data, config)

// 获取当前登录用户的基本信息
export const getUserInfo = () => http.post('/api/getUserInfo')
// 保存用户信息
export const setUserInfo = (data, config = {jsonHeader}) => http.post('/api/setUserInfo', data, config)
// 修改密码
export const setPwd = (data, config = {}) => http.post('/api/setPwd', qs.stringify(data), config)

//获取我的邮件
export const getMailboxs = (data, config = { jsonHeader}) => http.post('/api/mailbox/getMailboxs', data, config)
//查看邮件
export const getMailbox = (data, config = {}) => http.post('/api/mailbox/get', qs.stringify(data), config)

// 获取系统操作日志列表
export const getLogs = (data, config = { jsonHeader}) => http.post('/api/system/getLogs', data, config)
// 获取日志详情
export const getLog = (data, config = {}) => http.post('/api/system/getLog', qs.stringify(data), config)

// 退出登录
export const logout = (data, config = { jsonHeader }) => http.post('/api/logout', data, config)


// 员工列表
export const getUsers = (data, config = { jsonHeader}) => http.post('/api/user/getList', data, config)
// 校验登录账号
export const checkLoginName = (data, config) => http.post('/api/user/checkLoginName', qs.stringify(data), config)
//校验手机号
export const checkUserTele = (data, config) => http.post('/api/shop/checkUserTele', qs.stringify(data), config)
// 保存员工信息
export const saveUser = (data, config = {jsonHeader}) => http.post('/api/user/save', data, config)
// 账号注销
export const delUser = (data, config) => http.post('/api/user/del', qs.stringify(data), config)
// 账号禁用
export const disableUser = (data, config) => http.post('/api/user/disable', qs.stringify(data), config)
// 取消禁用
export const cancelDisable = (data, config) => http.post('/api/user/cancelDisable', qs.stringify(data), config)
// 重置密码
export const resetPassword = (data, config) => http.post('/api/user/resetPassword', qs.stringify(data), config)


//获取组织架构列表
export const getDeptList = (data, config = { jsonHeader }) => http.post('/api/sysDept/getList', qs.stringify(data), config)
//校验部门名称
export const checkDeptName = (data, config) => http.post('/api/sysDept/checkName', qs.stringify(data), config)
//获取组织架构
export const getDepts = (data, config) => http.post('/api/sysDept/getDepts', qs.stringify(data), config)
//保存组织架构
export const saveDept = (data, config = { jsonHeader }) => http.post('/api/sysDept/save', data, config)
//删除组织架构 - 单条删除
export const delDept = (data, config) => http.post('/api/sysDept/remove', qs.stringify(data), config)
//删除组织架构 - 批量操作
export const bachDelDept = (data, config) => http.post('/api/sysDept/bachRemove', qs.stringify(data), config)
// 获取部门下的员工
export const getDeptUserList = (data, config) => http.post('/api/sysDept/getUserList', qs.stringify(data), config)
// 移除部门下的员工
export const delUserDept = (data, config) => http.post('/api/sysDept/removeUser', qs.stringify(data), config)



// 首页提醒
export const getReminds = (data, config = {}) => http.post('/api/getReminds', qs.stringify(data), config)


//获取系统角色
export const getRoles = (data, config) => http.post('/api/roles/getRoles', data, config)

// 删除菜单
export const delMenu = (data, config) => http.post('/api/menu/delMenu', qs.stringify(data), config)
// 保存菜单
export const saveMenu = (data, config={jsonHeader}) => http.post('/api/menu/save', data, config)
//获取角色列表
export const getRoleList = (data, config) => http.post('/api/roles/getList', data, config)
// 删除角色
export const delRole = (data, config) => http.post('/api/roles/delRole', qs.stringify(data), config)
// 批量删除角色
export const delRoleByBach = (data, config = {}) => http.post('/api/roles/delRoleByBach', qs.stringify(data), config)



// 店铺添加角色
export const addShopRole = (data, config) => http.post('/api/roles/addShopRole', qs.stringify(data), config)
// 校验角色名称
export const checkRoleName = (data, config) => http.post('/api/roles/checkRoleName', qs.stringify(data), config)
// 保存角色信息
export const saveRole = (data, config={jsonHeader}) => http.post('/api/roles/save', data, config) 


// 根据角色ID, 获取角色被赋权的功能菜单(menuType==2)
export const getRoleMenus = (data, config) => http.post('/api/roles/getRoleMenus', qs.stringify(data), config)

// 根据角色ID, 获取角色被赋权的菜单ID(menuType in (2,3))
export const getRoleMenuIds = (data, config) => http.post('/api/roles/getRoleMenuIds', qs.stringify(data), config)
// 根据角色ID, 角色菜单的数据权限
export const getRoleDataRight = (data, config) => http.post('/api/roles/getRoleDataRight', qs.stringify(data), config)

// 保存角色权限
export const setRoleRight = (data, config) => http.post('/api/roles/setRoleRight', data, config)
// 设置角色的数据权限
export const setRoleDataRight = (data, config) => http.post('/api/roles/setRoleDataRight', qs.stringify(data), config)


//获取行政公告列表
export const getNotices = (data, config = { jsonHeader}) => http.post('/api/notices/getList', data, config)
//保存行政公告
export const saveNotice = (data, config = { jsonHeader}) => http.post('/api/notices/save', data, config)
//删除行政公告
export const delNotice = (data, config = {}) => http.post('/api/notices/del', qs.stringify(data), config)
//发布行政公告
export const sendNotice = (data, config = {}) => http.post('/api/notices/send', qs.stringify(data), config)
//获取行政公告
export const getNotice = (data, config = {}) => http.post('/api/notices/get', qs.stringify(data), config)



// //开通店铺的套餐
// export const getSysMeals = (data, config = {}) => http.post('/api/shop/getSysMeals', data, config)
// //获取员工
// export const getShopUsers = (data, config = {}) => http.post('/api/shop/getShopUsers', qs.stringify(data), config)

// //添加店员
// export const saveShopUser = (data, config) => http.post('/api/shop/saveShopUser', qs.stringify(data), config)

//获取会员列表
export const getMemberList = (data, config) => http.post('/api/member/getList', qs.stringify(data), config)
//校验会员电话
export const checkMemeberTele = (data, config) => http.post('/api/member/checkTele', qs.stringify(data), config)
//保存会员信息
export const saveMemeber = (data, config) => http.post('/api/member/saveMemeber', data, config)


